package com.rpc.tagparser;

import com.rpc.tagparser.bean.ReferenceConfigBean;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;

/**
 * @author didi
 * @DESCRIPTION
 * @create 2018-06-07 下午6:09
 **/

public class ReferenceConfigBeanDefinitionParser extends AbstractConfigDefinitionParser {
    @Override
    protected Class<?> getBeanClass(Element element) {
        return ReferenceConfigBean.class;
    }

    @Override
    protected void doParse(Element element, BeanDefinitionBuilder builder) {
        super.doParse(element, builder);

        String id = element.getAttribute("id");

        if (StringUtils.hasText("id")) {
            builder.addPropertyValue("beanId", id);
        }

    }
}
